{include file="common/header"}
<div id="app" v-cloak>
    <div class="el-pane-warp">
		<el-form ref="config" :model="config" :rules="rules" label-width="150px">
			<el-form-item label="默认头像：" prop="cover">
			    <el-file-select v-model="config.cover"></el-file-select>
			</el-form-item>
			<el-form-item label="默认昵称：" prop="nickname">
				<el-input v-model="config.nickname" placeholder="未命名"></el-input>
			</el-form-item>
			<el-form-item label="默认签名：" prop="describe">
				<el-input v-model="config.describe" placeholder="这人很懒，什么都没有留下。"></el-input>
			</el-form-item>
		</el-form>
		<div class="el-bottom">
			<el-button 
				size="medium"
				:loading="loading" 
				type="primary" 
				icon="el-icon-refresh-right" 
				@click="save()">
				保 存
			</el-button>
		</div>
	</div>
</div>
<script>
	new Vue({
	    el: '#app',
	    data() {
	        return {
	        	url: "config/register",
	        	config: {:json_encode($config)},
	        	loading: false,
	        	rules: {
	        	    captcha: [
                        { required: true, message: '请选择会员登录开启验证码', trigger: 'blur' },
                    ],
                    cover: [
                        { required: true, message: '请选择会员注册默认头像', trigger: 'blur' },
                    ],
                    nickname: [
                        { required: true, message: '请输入会员注册默认昵称', trigger: 'blur' },
                    ],
                    describe: [
                        { required: true, message: '请输入会员注册默认签名', trigger: 'blur' },
                    ],
	        	}
	        }
	    },
	    methods: {
	        /**
             * 保存基础配置
             */
	        save() {
	        	let self = this;
	        	self.$refs.config.validate((valid) => {
                    if (valid) {
                        self.loading = true;
        	        	request.post(self.url, {config: self.config}, function(res){
                            self.loading = false;
                            self.$notify({showClose: true, message: res.message, type: res.status});
                        });
                    } else {
                        return false;
                    }
                });
	        },
	    }
	})
</script>
{include file="common/footer"}